<?php

function encode($password)
{
	$trimstring = trim($password);
	
	$mixstring	= preg_replace('/\s+/', ',', $trimstring); 

	$delimiter 	= ',';

	$arraystring = explode($delimiter, $mixstring); 
	
	foreach($arraystring as $array) 
	{
		$hex .= base64_encode(strrev($array)); 
	}
	
	return $hex;
}

function decode($password)
{
	$trimstring = trim($password);
	
	$mixstring	= preg_replace('/\s+/', ',', $trimstring); 

	$delimiter 	= ',';

	$arraystring = explode($delimiter, $mixstring); 
	
	foreach($arraystring as $array) 
	{
		$hex .= strrev(base64_decode($array)); 
	}
	
	return $hex;
}
